home *** CD-ROM | disk | FTP | other *** search
- % Copyright (C) 1989, 1996 Aladdin Enterprises. All rights reserved.
- %
- % This software is licensed to a single customer by Artifex Software Inc.
- % under the terms of a specific OEM agreement.
-
- % $RCSfile: gs_epsf.ps,v $ $Revision: 1.8 $
- % Allow the interpreter to recognize MS-DOS EPSF file headers, and skip to
- % the PostScript section of the file.
-
- /.runnoepsf /run load def
- /.epsfheader <C5D0D3C6> def
- /run
- { dup type /filetype ne { (r) file } if
- % Check for MS-DOS EPSF file (see Red Book p. 729).
- true exch 0 1 3
- { % Stack: true file index
- 1 index read dup { pop dup .epsfheader 3 index get eq } if
- { pop pop } % if matched, don't need the character
- { % unread characters (wasn't EPSF)
- 2 index exch unread % unread mismatch character
- dup { % loop unreading backwards in .epsfheader
- 1 sub dup .epsfheader exch get 2 index exch unread
- } repeat pop
- exch not exch exit % change true to false
- }
- ifelse
- }
- for exch % Stack: file true/false
- { % This block is executed if the file is MS-DOS EPSF.
- % Build up the little-endian byte offset and length.
- 2
- { 1 0 4
- { 2 index read not { pop exit } if % if EOF, let error happen
- 2 index mul add exch 256 mul exch
- }
- repeat exch pop exch
- }
- repeat
- % Stack: offset length file
- % Use flushfile to skip quickly to the start of the
- % PostScript section.
- dup 4 -1 roll 12 sub () /SubFileDecode filter flushfile
- % Now interpret the PostScript.
- exch () /SubFileDecode filter cvx .runexec
- }
- { .runnoepsf
- }
- ifelse
- } odef
-